using System;
using System.Collections.Generic;
using NobleTech.Products.CreatureKingdom.Utils;

namespace NobleTech.Products.CreatureKingdom
{
    public class ViewPort
    {
        private RectangleD bounds;
        public RectangleD Bounds
        {
            get { return bounds; }
            set
            {
                bounds = value;
                smallestContainingQuadrant
                    = smallestContainingQuadrant.GetSmallestQuadrantContaining(bounds);
            }
        }

        private IQuadrant smallestContainingQuadrant = null;

        internal ViewPort(RectangleD bounds, IQuadrant anyQuadrant)
        {
            smallestContainingQuadrant = anyQuadrant;
            this.Bounds = bounds;
        }

        public IEnumerable<Organism> GetOrganisms()
        {
            return smallestContainingQuadrant.GetContainedOrganisms(bounds, 0);
        }
    }
}
